import Base from '@/common/js/common.js'
import request from '@/common/js/common/request.js'

// 查询服务记录列表
export function listRecord(query) {
    return request({
        url: '/app/server/serviceRecord/list',
        method: 'get',
        params: query
    })
}

// 查询服务记录详细
export function getRecord(serviceId) {
    return request({
        url: '/app/server/serviceRecord/' + praseStrEmpty(serviceId),
        method: 'get'
    })
}

//根据openid查询服务记录详情
export function getRecordByOpenId(openid) {
	return request({
		url: '/app/server/serviceRecord/' + openid,
		method: 'get'
	})
}

// 新增服务记录
export function addRecord(data) {
    return request({
        url: '/app/server/service',
        method: 'post',
        data: data
    })
}

// 修改服务记录
export function updateRecord(data) {
    return request({
        url: '/app/server/service',
        method: 'put',
        data: data
    })
}


// 修改服务记录完成状态
export function changeStatus(serviceId, serviceStatus) {
  const data = {
    serviceId,
    serviceStatus
  }
  return request({
    url: '/app/server/service/changeStatus',
    method: 'put',
    data: data
  })
}

//新增评价
export function addEvaluate(data) {
  return request({
    url: '/app/server/serviceRecord/addEvaluate',
    method: 'put',
    data: data
  })
}

// 删除服务记录
export function delRecord(serviceId) {
    return request({
        url: '/app/server/service/' + serviceId,
        method: 'delete'
    })
}

